package com.controller;

import com.domain.User;
import com.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.Calendar;

@Controller
public class LoginController {
    @Autowired
    private UserMapper userMapper;

    @GetMapping("/login")
    public String toLoginPage(Model model){
        User user = userMapper.findById(2);
        model.addAttribute("currentYear",Calendar.getInstance().get(Calendar.YEAR));
        model.addAttribute("user",user);
        return "login";
    }
}
